<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>用户信息列表</title>
    <link rel="icon" th:href="@{/favicon.ico}">
    <link rel="shortcut icon" th:href="@{/favicon.ico}">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <link type="text/css"  th:href="@{/css/index.css}" rel="stylesheet"  />
    <link type="text/css"  th:href="@{/css/jconfirm.css}" rel="stylesheet"  />
    <script th:src="@{/js/jQuery1.7.2.js}" type="text/javascript"></script>
    <script th:src="@{/js/index.js}" type="text/javascript"></script>
    <script th:src="@{/js/editpopup.js}" type="text/javascript"></script>
    <script th:src="@{/js/assignUserRole.js}" type="text/javascript"></script>
    <script th:src="@{/js/jconfirm.js}" type="text/javascript"></script>
    <script type="text/javascript" th:inline="javascript">
        $(function () {
            var $roles = [[${roles}]];
            /**
             * 显示编辑弹窗
             */
            $(".label").click(function () {
                showPopup($roles,$(this));
            });
        });
    </script>
</head>
<body>
    <div class="mian_center">
        <span class="main_titile"><img th:src="@{/images/login_j_03.png}">用户列表</span>

        <div class="main_con">
            <form id="searchFr" th:action="@{/user/list}" method="get">
                <ul>
                    <li><span>用户名:</span><input name="userName" type="text" th:value="*{param.userName}" placeholder="请输入用户名" autocomplete="off" /></li>
                    <li><span>用户角色:</span>
                        <select name="roleName">
                            <option value="">【请选择】</option>
                            <option th:if="${roles != null}" th:each="role : ${roles}"
                                    th:selected="*{param!=null && #strings.equals(param.roleName,role.roleId)}"
                                    th:value="${role.roleId}">[[${role.roleName}]]</option>
                        </select>
                    </li>
                    <li><span>状态:</span>
                        <select name="flag">
                            <option value="">【请选择】</option>
                            <option th:selected="*{param!=null && #strings.equals(param.flag,'1')}"
                                    th:value="1">已删除</option>
                            <option th:selected="*{param!=null && #strings.equals(param.flag,'0')}"
                                    th:value="0">未删除</option>
                        </select>
                    </li>
                    <li><span class="msg">[[${msg}]]</span></li>
                </ul>
                <span class="main_button">
                    <input  id="pSize"  name="pSize" type="hidden" th:value="*{param.pSize}" />
                    <input  id="currentPn"  name="pn" type="hidden" th:value="*{param.pn}" />
                    <input type="submit" value="查询" />
                </span>
            </form>

            <table>
                <tr>
                    <th width="30"><input type="checkbox" id="selectAll"></th>
                    <th width="50">序号</th>
                    <th>用户名</th>
                    <th>用户等级</th>
                    <th>创建时间</th>
                    <th>修改时间</th>
                    <th>操作</th>
                </tr>

                    <tr th:each="user : ${users}" th:with="u = ${user}">
                        <td><input type="checkbox" class="selectItem" th:value="${user.userId}"></td>
                        <td>[[${user.userId }]]</td>
                        <td>[[${user.userName }]]</td>
                        <td>[[${user.roleName }]]</td>
                        <td>[[${user.createTime==null?'--':#dates.format(user.createTime,'YYYY/MM/dd HH:mm:ss')}]]</td>
                        <td>[[${user.updateTime==null?'--':#dates.format(user.updateTime,'YYYY/MM/dd HH:mm:ss')}]]</td>
                        <td>
                            <a class="btn label" href="javascript: void(0);" th:index="${user.userId}" th:data="${user.roleId}" title="分配菜单">分配菜单</a>
                            <a th:if="${#strings.equals(user.flag,'0')}" class="btn" th:href="${'javascript: remove('+user.userId+');'}" title="删除">删除</a>
                            <a th:if="${#strings.equals(user.flag,'1')}" class="btn" th:href="${'javascript: recover('+user.userId+');'}" title="恢复">恢复</a>
                        </td>
                    </tr>
                    <tr th:if="${#lists.isEmpty(users)}">
                        <td colspan="7">暂无任何记录</td>
                    </tr>

            </table>
        </div>

        <div class="main_page_number" th:unless="${#lists.isEmpty(users)}" th:include="/common/page :: page">
        </div>

    </div>
</body>
</html>